textview: Avoid bubblewindow popup/popdown API
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 12 Nov 2013 13:22:08 +0000 (14:22 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 22 Jan 2014 16:10:04 +0000 (17:10 +0100)
Besides setting all positioning properties at once, popup() would just
show the widget, so do that directly after just updating the position.

gtk/gtktextview.c

index de6f41ee6c001eec4d14cfd7a1df1abae783b4d8..36265c00120ccd3b73997aacf4620d28a9ea433c 100644 (file)
@@ -8857,7 +8857,7 @@ activate_bubble_cb (GtkWidget   *item,
 {
   const gchar *signal = g_object_get_data (G_OBJECT (item), "gtk-signal");
   g_signal_emit_by_name (text_view, signal);
-  _gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (text_view->priv->selection_bubble));
+  gtk_widget_hide (text_view->priv->selection_bubble);
 }
 
 static void
@@ -8902,6 +8902,9 @@ bubble_targets_received (GtkClipboard     *clipboard,
     gtk_widget_destroy (priv->selection_bubble);
 
   priv->selection_bubble = _gtk_bubble_window_new (GTK_WIDGET (text_view));
+  _gtk_bubble_window_set_position (GTK_BUBBLE_WINDOW (priv->selection_bubble),
+                                   GTK_POS_TOP);
+
   toolbar = GTK_WIDGET (gtk_toolbar_new ());
   gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT);
   gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
@@ -8928,8 +8931,10 @@ bubble_targets_received (GtkClipboard     *clipboard,
   gtk_text_view_get_selection_rect (text_view, &rect);
   rect.x -= priv->xoffset;
   rect.y -= priv->yoffset;
-  _gtk_bubble_window_popup (GTK_BUBBLE_WINDOW (priv->selection_bubble),
-                            GTK_WIDGET (text_view), &rect, GTK_POS_TOP);
+
+  _gtk_bubble_window_set_pointing_to (GTK_BUBBLE_WINDOW (priv->selection_bubble),
+                                      &rect);
+  gtk_widget_show (priv->selection_bubble);
 
   priv->selection_bubble_timeout_id = 0;
 }
@@ -8955,7 +8960,7 @@ gtk_text_view_selection_bubble_popup_unset (GtkTextView *text_view)
   priv = text_view->priv;
 
   if (priv->selection_bubble)
-    _gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (priv->selection_bubble));
+    gtk_widget_hide (priv->selection_bubble);
 
   if (priv->selection_bubble_timeout_id)
     {
@@ -9219,7 +9224,7 @@ text_window_scroll        (GtkTextWindow *win,
   if (dx != 0 || dy != 0)
     {
       if (priv->selection_bubble)
-        _gtk_bubble_window_popdown (GTK_BUBBLE_WINDOW (priv->selection_bubble));
+        gtk_widget_hide (priv->selection_bubble);
       view->priv->in_scroll = TRUE;
       gdk_window_scroll (win->bin_window, dx, dy);
       view->priv->in_scroll = FALSE;